package cn.wolfcode.dubbo.product.service.impl;

import cn.wolfcode.dubbo.User.domain.User;
import cn.wolfcode.dubbo.User.service.IUserService;
import cn.wolfcode.dubbo.product.productdata.ProductData;
import cn.wolfcode.dubbo.product.domian.Product;
import cn.wolfcode.dubbo.product.service.IProductService;
import org.apache.dubbo.config.annotation.Reference;
import org.apache.dubbo.config.annotation.Service;
//生产者在生产服务的时候指定该服务的版本号
@Service(version = "1.0")
public class ProductServiceImpl implements IProductService {
    @Reference(version = "1.0")
    private IUserService userService;

    @Override
    public Product getProductById(Long id, Long userId) {
        User user = userService.get(userId);
        Product product = ProductData.get(id);
        product.setUser(user);
        return product;
    }
    //假装从数据库中读取数据

}
